﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Easyleave.Logic.Domain;

namespace Easyleave.WinformsTestClient
{
    public partial class LoginForm : Form
    {
        MembershipServiceClient membershipClient;
        public LoginForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            UserDto user = membershipClient.Authenticate(textBox1.Text.Trim(), textBox2.Text.Trim());
            if (user == null)
            {
                MessageBox.Show("Login failed!");
            }
            else
            {
                MainForm leaveForm = new MainForm();
                //LeaveForm leaveForm = new LeaveForm();
                leaveForm.User = user;
                this.Hide();
                leaveForm.Show();
            }

        }

        private void LoginForm_Load(object sender, EventArgs e)
        {
            membershipClient = new MembershipServiceClient("WSHttpBinding_IMembershipService");
        }
    }
}
